import { createRouter, createWebHistory } from 'vue-router'
import LayOut from '../layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      component: () => import('../views/login/index.vue')
    },
    {
      path: '/404',
      component: () => import('../views/404/index.vue')
    },
    {
      path: '/:catchAll(.*)',
      redirect: '/404'
    },
    {
      path: '/',
      component: LayOut,
      redirect: "/dashboard",
      children: [
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import('../views/dashboard/index.vue')
        },
        {
          path: '/statistics',
          name: 'statistics',
          component: () => import('../views/statistics/index.vue')
        },
        {
          path: '/employee',
          name: 'employee',
          component: () => import('../views/employee/index.vue')
        },
        {
          path: '/employee/add',
          name: 'addEmployee',
          component: () => import('../views/employee/components/addEmployee.vue')
        },
        {
          path: '/employee/avater',
          name: 'employeeAvater',
          component: () => import('../views/employee/components/employeeAvater.vue')
        },
        {
          path: '/employee/password',
          name: 'employeePassword',
          component: () => import('../views/employee/components/employeePassword.vue')
        },
        {
          path: '/department',
          name: 'department',
          component: () => import('../views/department/index.vue')
        },
        {
          path: '/staff',
          name: 'staff',
          component: () => import('../views/staff/index.vue')
        },
        {
          path: '/staff/add',
          name: 'addStaff',
          component: () => import('../views/staff/components/addStaff.vue')
        },
        {
          path: '/order',
          name: 'order',
          component: () => import('../views/order/index.vue')
        },
        {
          path: '/banners',
          name: 'banners',
          component: () => import('../views/banners/index.vue')
        },
        {
          path: '/announcement',
          name: 'announcement',
          component: () => import('../views/announcement/index.vue')
        },
        {
          path: '/announcement/add',
          name: 'addAnnouncement',
          component: () => import('../views/announcement/components/addAnnouncement.vue')
        },
        {
          path: '/ai',
          name: 'ai',
          component: () => import('../views/ai/index.vue')
        },
        
      ]
    }
  ]
})

export default router
